<?php $this->load('header')?>

<div class="tab">
	<ul>
		<li><a href="<?php echo url('comment.index')?>" <?php if (empty($filter)) {echo 'class="on"';}?>>全部评论</a></li>
		<li><a href="<?php echo url('comment.index','filter=unchk')?>" <?php if ($filter=='unchk') {echo 'class="on"';}?>>待审核(<?=$uncknum?>)</a></li>
	</ul>
</div>

<div class="main">

	<div class="search">
		<form name="search" method="get" action="admin.php">
		<input type="hidden" name="ac" value="list" />
		<input type="hidden" name="mod" value="<?php echo ACTION_NAME?>" />
			<fieldset>
				<legend>评论查找</legend>
					关键字：
					<input type="text" name="keyword" size="15" value="<?php echo $keyword; ?>" />
					<input type="submit" name="s" class="button" value="开始查找" />
			</fieldset>
		</form>
	</div>
	<form name="update" method="post" action="<?php echo url('comment.index')?>">
		<table class="datalist" id="list" cellspacing="0">
			<tr>
				<th width="30" class="firstcol">选择</th>
				<th width="200">作者</th>
				<th>评论</th>
				<th width="250">所在</th>
			</tr>

			<?php
			if  ( $result ) {
			foreach ($result as $row) { ?>
			<tr id="row_<?php echo $row['id']?>" <?php echo ($row['status'] ? '' : 'class="highlight"');?>>
				<td align="center" valign="top"><input type="checkbox" name="id[]" value="<?php echo $row['id']?>" class="checkbox" /></td>
				<td valign="top">
				<span class="avatar">
				<?php avatar($row['email'])?>
				</span>
				<b><?php echo $row['author'];?></b>
				<?php
				if ( $row['url'] ) {
					echo "<br /><a href=\"{$row[url]}\" title=\"{$row[url]}\" target=\"_blank\">{$row[url]}</a>";
				}
				if ( $row['email'] ) {
					echo "<br /><a href=\"mailto:{$row[email]}\">{$row[email]}</a>";
				}
				if ( $row['ip'] ) {
					echo "<br /><a href=\"#\">{$row[ip]}</a>";
				}
				?>
				</td>
				<td valign="top">
					<div style="color:#666">发布于 <a href="<?php echo url('mod=post&id='.$row['postid'])?>#comment-<?php echo $row['id']?>" target="_blank" title="查看评论"><?php echo get_date($row['dateline']);?></a></div>
					<div id="c_<?php echo $row['id']?>" style="font-size:13px"><?php echo $row['content']?></div>
					<div class="row_action">
					<div class="admintools">
					<?php if ( $row['status'] == 1 ) { ?>
					<a href="?mod=comment&ac=nopass&id=<?php echo $row['id'];?>" style="color:#f60">驳回</a> |
					<?php } else { ?>
					<a href="?mod=comment&ac=pass&id=<?php echo $row['id'];?>" style="color:green">通过</a> |
					<?php } ?>
					<a href="?mod=comment&ac=edit&id=<?php echo $row['id'];?>">编辑</a> |
					<a href="?mod=comment&ac=reply&id=<?php echo $row['id'];?>">回复</a> |
					<a href="?mod=comment&ac=delete&id=<?php echo $row['id']?>" style="color:#c00">删除</a>
					</div>
					</div>
				</td>
				<td align="left" valign="top" style="color:#666">
				<a href="<?php echo url('mod=post&id='.$row['postid'])?>" target="_blank"><?php echo cut_str($row['title']) ?></a>
				<br />发表于 <?php echo get_date($row['posttime'])?>
				</td>
			</tr>
			<?php
				}
			} else {
				echo '<tr><td colspan="10">暂无记录...</td></tr>';
			}
			?>
			<tr>
				<td align="center">
				<input type="checkbox" class="checkbox" value="1" name="chkall" id="chkall" onclick="check_all(this)" /></td>
				<td colspan="5">
				<label for="chkall">全选</label>
				<input type="radio" name="ac" value="pass" id="ac_pass" class="radio" checked /><label for="ac_pass">通过</label>
				<input type="radio" name="ac" value="nopass" id="ac_nopass" class="radio" /><label for="ac_nopass">驳回</label>
				<input type="radio" name="ac" value="delete" id="ac_delete" class="radio" /><label for="ac_delete">删除</label>
				<input type="submit" class="submit" value="执行操作"/>
				</td>
			</tr>
			<tr>
				<td colspan="10"><?php echo $page?></td>
			</tr>
		</table>
	</form>

</div>

<script type="text/javascript">
$( function() {
	$('#list tr').each( function() {
		$(this).mouseover( function() {
			$(this).children().find('.admintools').show();
		});
		$(this).mouseout( function() {
			$(this).children().find('.admintools').hide();
		});
	});
});
</script>

<?php $this->load('footer')?>